home *** CD-ROM | disk | FTP | other *** search
/ BCI NET / BCI NET Dec 94.iso / archives / grafix / misc / ami2d_2_0.lha / ami2d_dist / files / nowshell / ami2d.rexx next >
Encoding:
OS/2 REXX Batch file  |  1994-09-19  |  3.4 KB  |  125 lines

  1. /*
  2. @Node Header
  3. @Next Macro
  4.  
  5. Code:       ami2d.rexx
  6. Author:     Russell Leighton
  7. Revision:   16 Feb 1994
  8.  
  9. Comments:
  10.  
  11. This  script  sets  up  Ami2D to be used interactivily.  It may be executed
  12. directly  from  the  command  line or by double clicking on the Ami2D icon.
  13. The  script  executes  Ami2D  and  calls other scripts to setup rexxcon and
  14. rexxbar.   It  then  goes into an infinite loop which continuously issues a
  15. read  command  to  rexxcon  to obtain commands typed into rexxcon's window.
  16. These commands are in turn issued to Ami2D.  However, if the command starts
  17. with  a  !   then  the  command  is  issued  to the command line (AmigaDOS)
  18. instead.   Also  if  the  command  is stop then the loop is exitted and all
  19. tasks  are  stopped.   If  for some reason this script fails then the tasks
  20. will   not  be  properly  terminated.   If  this  occurs  then  the  script
  21. cleanup.rexx should be executed to force termination of remaining tasks.
  22.  
  23. @EndNode
  24. @Node Macro
  25. */
  26.  
  27. options results
  28.  
  29. if ~show('l', "rexxarplib.library") then do
  30.     check = addlib('rexxarplib.library',0,-30,0)   
  31. end
  32.  
  33. call pragma('stack',50000)
  34.  
  35. address command
  36.  
  37. 'assign ami2d: /ami2d'
  38.  
  39. /* For WShell (CNC: device), the next line should be uncommented */
  40.  
  41. /* 'dhopts menu ami2d:rexx/ami2d-menus name ami2d' */
  42.  
  43. if ~show('ports', "AMI2D") then do
  44.     'run ami2d:bin/ami2d ami2d:rexx/init'
  45.     'waitforport AMI2D'
  46. end
  47.  
  48. /* The following line will open the Ami2D screen in 
  49.    whatever mode the Workbench is set at */
  50.  
  51. address ami2d 'open'
  52.  
  53. /* The following line will force the Ami2D screen to
  54.    open in the PICASSO:1024x768 mode */
  55.  
  56. /* address ami2d 'open(-68,-50,PICASSO:1024x768)' */
  57.  
  58. /* The following line will force the Ami2D screen to
  59.    open in the "NTSC:High Res Laced" mode */
  60.  
  61. /* address ami2d 'open(0,0,"NTSC:High Res Laced")' */
  62.  
  63. if rc > 0 then do
  64.     address ami2d 'why'
  65.     if length(result) > 0 then say result
  66.     exit
  67. end
  68.  
  69. /* call 'ami2d:rexx/rexxbar' */
  70. call 'ami2d:rexx/mainbar'
  71. call 'ami2d:rexx/geombar'
  72. call 'ami2d:rexx/helpbar'
  73. call 'ami2d:rexx/rexxcon'
  74.  
  75. address rxb_ami2d 'open'
  76. parse var result ix iy iw ih
  77.  
  78. address ami2d 'open('0 - iw',-50)'
  79.  
  80. error:
  81. signal on error
  82.  
  83. do forever
  84.     address rxc_ami2d 'read'
  85.     comm = result
  86.     if comm = 'stop' then leave
  87.     if index(comm,'!cd') = 1 then do
  88.         if length(pragma('directory',substr(comm,5))) = 0 then iterate
  89.     end
  90.     n = index(comm,"!")
  91.     if n = 1 then do
  92.         if length(comm) = 1 then do
  93.             comm = GetFile(,,,,"select macro","AMI2D","PATGAD",,,,"#?.rexx")
  94.             if length(comm) = 0 then iterate
  95.         end
  96.         else comm = substr(comm,2)
  97.         comm '>pipe:ami2d'
  98.         call open('ami2d','pipe:ami2d','R')
  99.         do while ~eof('ami2d')
  100.             line = readln('ami2d')
  101.             if length(line) ~= 0 then address rxc_ami2d 'write("'line'")'
  102.         end
  103.         call close('ami2d')
  104.     end
  105.     else do
  106.         address ami2d comm
  107.         if rc > 0 then address ami2d 'why'
  108.         if length(result) > 0 then address rxc_ami2d 'write("'result'")'
  109.     end
  110. end
  111.  
  112. call postmsg
  113. if show('ports',"RXB_MAIN") then address rxb_main 'stop'
  114. if show('ports',"RXB_AMI2D") then address rxb_ami2d 'stop'
  115. if show('ports',"RXB_HELP") then address rxb_help 'stop'
  116. if show('ports',"RXC_AMI2D") then address rxc_ami2d 'stop'
  117. if show('ports', "NLN2D") then address nln2d 'stop'
  118. address ami2d 'stop'
  119.  
  120. /* For WShell (CNC: device), the next line should be uncommented */
  121.  
  122. /* 'dhopts delete ami2d' */
  123.  
  124. exit
  125.